import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr


def send_email(smq):
    msg = MIMEText('发送邮件的测试', 'html', 'utf-8')  # 内容 格式 标头
    msg["From"] = formataddr(("韩成瑾", "3025674837@qq.com"))  # 邮件上显示发件人
    # 邮件上显示得主题
    msg["Subject"] = "测试邮件发送"
    msg["Smq"] = "3025674837@qq.com"
    # 发送邮件
    server = smtplib.SMTP_SSL("smtp.qq.com")
    server.login("3025674837@qq.com", "abrbwnnzdqxpdgje")
    server.sendmail("3025674837@qq.com", smq, msg.as_string())
    server.quit()



send_email("3025674837@qq.com")  # 收件人